﻿class DefaultEnvironment implements IEnvironment {
    drawSwarm: IDrawSwarm;
    NrOfBoids: number;
    swarm: Array<Boid>;

    constructor() {
        this.NrOfBoids = 100;

        this.drawSwarm = new DefaultDrawSwarm();
        this.drawSwarm.Init(this);

        this.swarm = new Array<Boid>(this.NrOfBoids);

        for (var i = 0; i < this.NrOfBoids; i++) {
            this.swarm[i] = new Boid();
        }
    }

    GenerateContent(drawArea: IDrawArea) {
        for (var i = 0; i < this.NrOfBoids; i++) {
            this.swarm[i].CalculateNeighbours(this.swarm);
            this.swarm[i].Move();
        }
        this.drawSwarm.Draw(drawArea);
    }

    GetBoid(index: number): Boid {
        return this.swarm[index];
    }

}